package com.xbongbong.paas.service;

import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.elasticsearch.pojo.dto.SearchDataInConditionDTO;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.pojo.ItemDataPoJo;
import com.xbongbong.paas.pojo.dto.SearchInConditionDTO;
import com.xbongbong.paas.pojo.dto.UserAndDepartmentGetDTO;
import com.xbongbong.paas.pojo.vo.SearchDataInConditionVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.formexplain.pojo.ConditionExplainPojo;
import org.elasticsearch.index.query.BoolQueryBuilder;

import java.util.List;

/**
 * @author: wufeng
 * @date: 2018/10/29 11:22
 * @desrcption:
 */
public interface DistinctDataService {

    /**
     * 下拉框关联其他表单获取数据
     * @param searchDataInConditionDTO
     * @return
     * @throws XbbException
     */
    SearchDataInConditionVO listOfLinkForm(SearchDataInConditionDTO searchDataInConditionDTO) throws XbbException;

    /**
     * 下拉框数据联动获取去重数据-流程条件使用的
     * @param searchDataInConditionDTO
     * @return
     * @throws XbbException
     */
    SearchDataInConditionVO listOfRely(SearchDataInConditionDTO searchDataInConditionDTO) throws XbbException;

    /**
     * 联动数据获取数据-新建、编辑页面使用的
     * @param searchDataInConditionDTO
     * @return
     * @throws XbbException
     */
    SearchDataInConditionVO linkRelyList(SearchDataInConditionDTO searchDataInConditionDTO) throws XbbException;

    /**
     * 单行文本获取去重数据
     * @param conditionExplainPojo
     * @param fieldAttrEntity 字段实体，也可能是子表单的字段实体
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum 字段枚举
     * @return
     * @throws XbbException
     */
    SearchDataInConditionVO listOfText(ConditionExplainPojo conditionExplainPojo, FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;
    /**
     * 下拉复选，复选框关联其他表单和数据联动获取去重数据
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum
     * @return
     */
    SearchDataInConditionVO listOfArray(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;

    /**
     * 关联业务选择获取数据
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum
     * @return
     */
    SearchDataInConditionVO listOfLinkBusiness(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;

    /**
     * 选择产品获取数据
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum
     * @return
     */
    SearchDataInConditionVO listOfSelectProduct(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;
    /**
     * 选择采购合同获取数据
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum
     * @return
     */
    SearchDataInConditionVO listOfSelectPurchase(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;

    /**
     * 编号获取数据
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum
     * @return
     */
    SearchDataInConditionVO listOfSelectSerialNo(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;

    SearchDataInConditionVO listOfStar(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum);

    /**
     * 工单超时
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum
     * @return
     */
    SearchDataInConditionVO listOfWorkOrderOut(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum);

    /**
     * 工单状态
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum
     * @return
     */
    SearchDataInConditionVO listOfWorkOrderStatus(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum);

    /**
     * 地址
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum
     * @return
     * @throws XbbException
     */
    SearchDataInConditionVO listOfAddress(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;

    /**
     * 工单阶段
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum
     * @return
     */
    SearchDataInConditionVO listOfWorkOrderStage(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum);

    /**
     * Description: 工单节点状态
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @param fieldTypeEnum
     * @author 刘阳
     * @date 2019/6/11 3:13 PM
     * @since v1.0
     */
    SearchDataInConditionVO listOfWorkOrderNodeStatus(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum);

    /**
     * 生日筛选下拉选项
     *
     * @return com.xbongbong.paas.pojo.vo.SearchDataInConditionVO
     * @author 徐俊杰
     * @date 2019/6/19 13:44
     * @since v1.0
     */
    SearchDataInConditionVO listOfBirthday();

    void productCondition(BoolQueryBuilder boolQueryBuilder, Integer businessType, Integer subBusinessType, String attr);

    /**
     * 自定义关联数据获取数据
     * @param fieldAttrEntity
     * @param searchDataInConditionDTO
     * @return com.xbongbong.paas.pojo.vo.SearchDataInConditionVO
     * @author 石安
     * @date 2020-03-11
     */
    SearchDataInConditionVO listOfLinkData(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO) throws XbbException;

    SearchDataInConditionVO listOfProductEnable(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum);

    SearchDataInConditionVO listOfRefId(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;

    SearchDataInConditionVO listOfBusinessId(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;

    SearchDataInConditionVO listOfBusiness(SearchDataInConditionDTO searchDataInConditionDTO) throws XbbException;

    SearchDataInConditionVO listOfLabel(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;

    SearchDataInConditionVO listOfScoreRange(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;

    SearchDataInConditionVO listofStageInfo(SearchDataInConditionDTO searchDataInConditionDTO, FieldAttrEntity fieldAttrEntity) throws XbbException;

    /**
     * 封装人员筛选选项
     * @param searchInConditionDTO
     * @return com.xbongbong.paas.pojo.vo.SearchDataInConditionVO
     * @throws XbbException
     * @author 吴峰、饶龙等
     * @since v1.0
     * @version v1.0
     * @update 2022.6.28 by zcp 封装人员筛选方法，内部逻辑未做任何改动
     */
    SearchDataInConditionVO listOfUser(SearchInConditionDTO searchInConditionDTO) throws XbbException;

    /**
     * 封装部门筛选选项
     * @param searchInConditionDTO
     * @return com.xbongbong.paas.pojo.vo.SearchDataInConditionVO
     * @throws XbbException
     * @author 吴峰
     * @since v1.0
     * @version v1.0
     * @update 2022.6.28 by zcp 封装人员筛选方法，内部逻辑未做任何改动
     */
    SearchDataInConditionVO listOfDepartment(SearchInConditionDTO searchInConditionDTO) throws XbbException;

    /**
     * 模糊查询
     * @param conditionValue
     * @param fieldAttrEntity
     * @param corpid
     * @param formId
     * @param businessType
     * @param saasMark
     * @param boolQueryBuilder
     * @return void
     * @author 吴峰
     * @date 2022/3/28 9:55
     * @throws XbbException
     */
    void likeBoolQuery(Object conditionValue, FieldAttrEntity fieldAttrEntity, String corpid, Long formId,
                       Integer businessType, Integer saasMark, BoolQueryBuilder boolQueryBuilder) throws XbbException;

    List<ItemDataPoJo> getItemDataList(UserAndDepartmentGetDTO userAndDepartmentGetDTO,
                                       List<PaasFormDataEntityExt> dataList, FieldAttrEntity fieldAttrEntity, Integer saasMark, Integer businessType, Long formId, FieldAttrEntity thisFieldAttrEntity) throws XbbException;


    List<ItemDataPoJo> getLabelDataList(String corpid, Long formId, List<PaasFormDataEntityExt> dataList, String linkFieldAttr) throws XbbException;

    SearchDataInConditionVO listOfPublicGroup(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;

    SearchDataInConditionVO listOfSelectContract(FieldAttrEntity fieldAttrEntity, SearchDataInConditionDTO searchDataInConditionDTO, FieldTypeEnum fieldTypeEnum) throws XbbException;
}
